<template>
  <div class="Xseats">
    <div class="Xseats-wrap">
      <div class="movie-list-container">
        <div class="movie-list">
          <div class="movie" v-for="item in 5">
            <img v-if="saLaData"
                 :src="saLaData[0].tbMovie.imgUrl"
                 alt=""
            />
          </div>
        </div>
      </div>
      <h2 class="cindetail-h2" v-if="saLaData">
        {{saLaData[0].tbMovie.movieName}} <span class="score">9.2</span>
        <span class="score-msg">人想看</span>
      </h2>
      <div class="movie-desc">
        <div>
          <span class="key">时长：</span><span class="value">134分钟</span>
        </div>
        <div><span class="key">类型：</span><span class="value">剧情</span></div>
        <div>
          <span class="key">主演：</span><span class="value">彭于晏</span>
        </div>
      </div>
      <div class="Xseats-steps">

        <Steps :activeindex="1"></Steps>
      </div>
      <div>
        <p class="crumbs-nav-container">
          <span>猫眼</span>><span>影院</span>><span v-if="saLaData">{{ saLaData[0].tbCinema.cinemaName }}</span>
        </p>

        <div class="show-date">
          <span>观影时间：</span>
          <span class="date-item active">今天 12月22</span>
          <span class="date-item">今天 12月22</span>
          <span class="date-item">今天 12月22</span>
        </div>
        <div class="plist-container">
          <table class="plist">
            <thead>
            <tr>
              <th>放映时间</th>
              <th>语言版本</th>
              <th>放映厅</th>
              <th>售价（元）</th>
              <th>选座购票</th>
            </tr>
            </thead>
            <tbody class="plistList">
            <tr v-for="item in saLaData">
              <td>
                <span class="begin-time">{{item.showTime}}</span><br />
                <span class="end-time">14:04散场</span>
              </td>
              <td><span class="lang">{{item.languageType}}</span></td>
              <td><span class="hall">{{item.salaName}}</span></td>
              <td>
                <span class="stonefont">￥</span>
                <span class="stonefont">{{item.moviePrice}}</span>
              </td>
              <td><span class="buy-btn" @click="toXseat(item.saLaId)">购票选坐</span></td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>

</template>

<script setup>
 import {getSaLa} from './api/index'
 import {ref,onMounted} from 'vue'
 import { useRoute } from "vue-router";
 import router from '../../router/index.js'
 import Steps from "@/views/Seat/seats/Steps.vue";
 const route = useRoute();
 const saLaData = ref(null)
 let movieId= ref(null)
 const getSaLaData=async(movieId,cinemaId)=>{
    saLaData.value= await getSaLa(cinemaId,movieId)
 }
 const toXseat= (salaTimeId)=>{
   router.push(`/seat/${salaTimeId}/${movieId.value}`)
 }
 onMounted(()=>{
 let mId=route.params.movieId
   movieId.value=mId;
 let cinemaId=route.params.cinemaId   
    getSaLaData(mId,cinemaId)
})
</script>

<style lang="scss" scoped>
.Xseats {
  margin-top: 80px;
  overflow: hidden;
}

.Xseats-wrap {
  width: 1200px;
  margin: 0 auto;
}
.Xseats-wrap .Xseats-steps {
  height: 60px;
  margin: 40px 0;
}
.Xseats-wrap .Xseats-main {
  width: 1200px;
  border: 1px solid #e5e5e5;
  display: flex;
  margin-bottom: 50px;
}
.cindetailHeader {
  width: 100%;
  height: 80px;
  background: #ffffff;
  border-bottom: 1px solid #d8d8d8;
}
.banner {
  width: 100%;
  height: 370px;
  background: bisque;
  margin-bottom: 80px;
}
.crumbs-nav-container {
  width: 1200px;
  margin: 0 auto;
  margin-bottom: 25px;
  font-size: 14px;
  color: #666;
}
.movie-list-container {
  width: 1200px;
  height: 280px;
  margin: 0 auto;
  padding: 22px 5px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: inset 0 0 100px 80px #ededed;
  .movie-list {
    .movie {
      width: 162px;
      height: 227px;
      border: 4px solid #fff;
      box-shadow: 0 1px 3px 0 hsla(0, 0%, 66%, 0.5);
      display: inline-block;
      transform-origin: 50%;
      transform: scale(0.82);
      img {
        width: 100%;
        height: 100%;
      }
    }
    div:nth-child(1) {
      transform: scale(1);
      border: 4px solid #f24030;
    }
  }
}
.cindetail-h2 {
  width: 1200px;
  margin: 0 auto;
  font-size: 26px;
  font-weight: 400;
  color: #333;
  margin-top: 20px;
  margin-bottom: 20px;
  span {
    font-size: 24px;
    color: #faaf00;
  }
  .score {
    margin-left: 20px;
  }
  .score-msg {
    font-size: 12px;
    margin-left: -5px;
  }
}
.movie-desc {
  width: 1200px;
  // padding-bottom: 20px;
  margin: 0 auto;
  border-bottom: 1px solid #e5e5e5;
  div {
    display: inline-block;
    font-size: 14px;
    color: #151515;
    margin-bottom: 20px;
    margin-right: 40px;
    .key {
      color: #999;
    }
  }
}
.show-date {
  width: 1200px;
  margin: 0 auto;
  padding: 30px 0;
  font-size: 14px;
  color: #999;
  .date-item {
    display: inline-block;
    background-color: transparent;
    border-radius: 100px;
    font-size: 14px;
    color: #333;
    padding: 2px 10px;
    margin-left: 12px;
    cursor: default;
  }
  .active {
    color: #fff;
    background-color: #f03d37;
  }
}
.plist-container {
  width: 1200px;
  margin: 0 auto;
  margin-bottom: 100px;
  .plist {
    width: 100%;
    border: none;
    border-spacing: 0;
    thead {
      background-color: #f7f7f7;
      color: #333;
      font-size: 16px;
      padding: 18px 0;
      th {
        padding: 16px 0;
      }
    }
    tbody {
      height: 82px;
      tr {
        height: 82px;
      }
      td {
        text-align: center;
        width: 20%;
      }
      .begin-time {
        font-size: 18px;
        color: #333;
        font-weight: 700;
      }
      .end-time {
        font-size: 12px;
        color: #999;
      }
      .lang,
      .hall {
        font-size: 14px;
        color: #333;
      }
      .stonefont {
        font-size: 18px;
        color: #f03d37;
        font-weight: 700;
      }
      .buy-btn {
        display: inline-block;
        width: 80px;
        height: 30px;
        color: #fff;
        background-color: #f03d37;
        font-size: 14px;
        line-height: 30px;
        border-radius: 100px;
        text-align: center;
        box-shadow: 0 2px 10px -2px #f03d37;
      }
    }
    .plistList tr:nth-child(2n) {
      background: #f7f7f7;
    }
  }
}
</style>